import UnmodifiableCollection from "../core/UnmodifiableCollection";
import Set from "./Set";
import UnsupportedOperationException from "../exceptions/UnsupportedOperationException";
import Obj from "../core/Obj";

export default class UnmodifiableSet<E> extends UnmodifiableCollection<E> implements Set<E> {
  private readonly set: Set<E>;
  public constructor(set: Set<E>) {
    super(set);
    this.set = set;
  }

  add(e: E): boolean {
    throw new UnsupportedOperationException(UnmodifiableSet, this.add);
  }

  clear() {
    throw new UnsupportedOperationException(UnmodifiableSet, this.clear);
  }

  equals(b: Obj): boolean {
    return this.set.equals(b);
  }

  grow(capacity: number) {
    throw new UnsupportedOperationException(UnmodifiableSet, this.grow);
  }

  hashCode(): number {
    return this.set.hashCode();
  }

  remove(e: E): boolean {
    throw new UnsupportedOperationException(UnmodifiableSet, this.remove);
  }

  removeIf(filter: (e: E) => boolean): boolean {
    throw new UnsupportedOperationException(UnmodifiableSet, this.removeIf);
  }

  removeFirst(e: E): boolean {
    throw new UnsupportedOperationException(UnmodifiableSet, this.removeFirst);
  }
}
